how to solve long statements of ap